#include <iostream>
#include <map>
#include <string>

int main() {
    // 创建一个 map 容器，存储员工的姓名和年龄
    std::map<std::string, int> employees;
    //map<keytype , valuetype> mapname;

    // 插入员工信息
    // 每个键都是具有唯一性
    employees["Alice"] = 30;
    employees["Bob"] = 25;
    employees["Charlie"] = 35;
    //mapname[key] = value;
    //value = mapname[key];

    // 遍历 map 并打印员工信息
    for (std::map<std::string, int>::iterator it = employees.begin(); it != employees.end(); ++it) {
        std::cout << it->first << " is " << it->second << " years old." << std::endl;
    }
    if(employees.find("Alice") != employees.end()){
        std::cout<<"the key called \"Alice\" is existing, and the value is: "
                << employees["Alice"] << std::endl;
    }
    std::cout<<"the size before erase the Bob:"<<employees.size()<<std::endl;
    employees.erase("Bob");
    std::cout<<"the size after erase the Bob:"<<employees.size()<<std::endl;
    for(std::map<std::string , int>::iterator it = employees.begin(); it != employees.end(); ++it){
        std::cout<< it->first <<" ==> "<< it->second <<std::endl;
    }
    return 0;
}